<?php
namespace app\backend\org;

class Voice
{
    static  public function voice(&$voice)//,&$voice_node
    {
        $files = request()->file('voice_url');
//var_dump($files);exit;
        if(!empty($files)){
            /*var_dump(
                $files
            );*/
            foreach($files as $file){
               // var_dump($file);exit;
                /*if(!is_dir(ROOT_PATH.'public'.DS.'voice')){
                    mkdir(ROOT_PATH.'public'.DS.'voice');
                }*/
                // 移动到框架应用根目录/public/uploads/ 目录下
                $info = $file->validate(['ext'=>'flv,wmv ,rmvb ,mp4'])->move(ROOT_PATH . 'public' . DS . 'voice');
                if($info){
                    $voice='/voice/'.date("Ymd")."/".$info->getfilename();
                   /* $copy = copy(ROOT_PATH.'public'.DS.'voice'.DS.date("Ymd").DS.$info->getfilename(),ROOT_PATH.'public'.DS.'node'.DS.'voice'.DS.date("Ymd").DS.$info->getfilename());
                    if($copy){
                        $voice_node  = DS.'node'.DS.'voice'.DS.date("Ymd").DS.$info->getfilename();

                        return true;
                    }else{
                        return false;
                    }*/
                }else{
                    // 上传失败获取错误信息
                    return false;
                }
            }
        }
return true;
    }

}